
#include <string>
#include <vector>
#include "freeformrulebase.h"
using namespace std;

/**
 * In this experiment we create the rulebase for all the images in \img\\B1B2-2025\\
 * For each image we first take bit 0 as input and 1 as output, then 0,1 as input and
 * 2 as output, then 0,1,2 input and 3 output and so on. We then measure the number of
 * rules in each ruleset and also the number of conflicting rules in each. This gives 
 * us an estimation of the rate of growth of the rulebase and the info required for each 
 * step during generation of patterns.
 */
void experiment1 (void);

///like above but creates SingleSteps and RuleTangles instead of rulebase objects.
void ex_resolveBySSRT (Rectangle2FormationAlgorithmType method, string inputFolder, string outputFolder, int firstImage, int lastImage);

///like above but creates RuleBaseption objects instead of singlestep objects.
void ex_resolveByRBS (string inputFolder, string outputFolder, int firstImage, int lastImage);

///like experiment1 but increases the Neighborhood Radius gradually until there is no more conflict.
/**
 * Resolves the conflicts by enlarging the neighborhood, then removes the unimportant neighbors.
 * \param vecRemoveOrder list of the removing order we want to use to remove the unimportant neighbors.
 * \param inputFolder Where the image files are stored. The names should be (i).bmp, where 0 < i < 129
 * \param outputFolder Where to store the report files. Each member of vecRemoveOrder creates 3 files.
 * the rule num, rule size and info size for each method is saved in a file.
 * \param firstImage The index of starting image in the inputFolder.
 * \param lastImage The index of last image in the inputFolder.
 */
void ex_resolveByNR (const vector<discardingOrder>& vecRemoveOrder, const string& inputFolder, const string& outputFolder, int firstImage, int lastImage);
//void ex_resolveByNR (const vector<discardingOrder>& vecRemoveOrder, const string& inputFolder, const string& outputFolder, int firstImage, int lastImage, int consoleColorIndex);

void ex_resolveByNR_AllOrders__Multithread_ParallelOrders (const string& inputFolder, const string& outputFolder, int firstImage, int lastImage);
void ex_resolveByNR_AllOrders__Multithread_ParallelImageSets (const string& inputFolder, const string& outputFolder, int firstImage, int lastImage);

void ex_resolveBySSRT_Multithread_OneMethod (Rectangle2FormationAlgorithmType method, const string& inputFolder, const string& outputFolder, int firstImage, int lastImage);
//void ex_resolveBySSRT_Multithread_AllMethods (const string& inputFolder, const string& outputFolder, int firstImage, int lastImage);

void ex_resolveByRBS_Multithread (const string& inputFolder, const string& outputFolder, int firstImage, int lastImage);

void ex_resolveByFFRBOnly (const string& inputFolder, const string& outputFolder, int firstImage, int lastImage);

void ex_RB2FFRB(void);

/**
 * Compares the 3 methods (VariableNB, Rulebaseption, SSRT) for a specific image only. Creates detailed report on 
 * the ruleset.
 */
void ex_detailedComparison (const string& inputFolder, const string& outputFolder, int imageIndex, int startBit, int endBit);

/**
 * Compares the 3 different SSRT (rectangles) methods for a specific image only. Creates detailed report on 
 * the ruleset.
 */
void ex_SSRTsComparison (const string& inputFolder, const string& outputFolder, int imageIndex, int startBit, int endBit);

///** 
// * Runs a symbiotic evolutionary algorithm where individuals are SEARuleSet to find the rules
// * that develop from previous steps to the next.
// */
void ex_SEA (string outputFolder);